package com.yjd.bi.jf.service.impl;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSON;
import com.yjd.bi.jf.dao.IJfIntegralDao;
import com.yjd.bi.jf.enums.JfIntegralDataIncrEnum;
import com.yjd.bi.jf.enums.JfIntegralDataRefTableEnum;
import com.yjd.bi.jf.enums.JfIntegralDataType;
import com.yjd.bi.jf.model.JfIntegralModel;
import com.yjd.bi.jf.service.IJfIntegralDataService;
import com.yjd.bi.jf.service.IJfIntegralService;
import com.yjd.bi.jf.service.IJfIntegralYearService;
import com.yjd.comm.annotation.ServiceRemoteProxy;
import com.yjd.comm.base.dao.IBaseDao;
import com.yjd.comm.base.enums.DbWREnums;
import com.yjd.comm.base.service.impl.BaseServiceImpl;
import com.yjd.comm.borrow.model.BorrowModel;
import com.yjd.comm.borrow.model.InvestModel;
import com.yjd.comm.borrow.service.IBorrowService;
import com.yjd.comm.borrow.service.IInvestService;
import com.yjd.comm.enums.UserEnums.Channel;
import com.yjd.comm.util.FrameUtil;

/**
 * <b>description</b>：会员积分表业务实现<br>
 * <b>time</b>：2017-03-07 15:06:52 <br>
 * <b>author</b>：  ready percy-chen@hotmail.com
 */
@Service("jfIntegralService")
public class JfIntegralServiceImpl extends BaseServiceImpl implements IJfIntegralService {

	/**
	 * 插入
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public JfIntegralModel insert(JfIntegralModel model) throws Exception {
		return this.jfIntegralDao.insertModel(model, true);
	}

	/**
	 * 更新
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public int update(JfIntegralModel model) throws Exception {
		return this.jfIntegralDao.updateModel(model, true);
	}

	/**
	 * 根据id删除
	 * 
	 * @param user_id
	 * @return
	 * @throws Exception
	 */
	public int delete(long user_id) throws Exception {
		Map<Object, Object> paramMap = new HashMap<Object, Object>();
		paramMap.put("user_id", user_id);
		return this.jfIntegralDao.deleteModel(paramMap, true);
	}

	
	
	
    @Override
    public void investJFHand(Long invest_id) throws Exception {
	
	
    }

	
    @Override
	public Integer getSummary(Map<String, Object> paramMap)
			throws Exception {
    	Integer result=jfIntegralDao.getSummary(paramMap);
		return result==null?0:result;
	}

	@Resource
	private IJfIntegralDataService jfIntegralDataService;
	
	@Resource
	private IJfIntegralYearService jfIntegralYearService;
	
	@ServiceRemoteProxy
	private IInvestService investService;
	
	@ServiceRemoteProxy
	private IBorrowService borrowService;

	@Resource
	private IJfIntegralDao jfIntegralDao;

	@Override
	public IBaseDao getBaseDao() {
		return this.jfIntegralDao;
	}

	@Override
	public int updateByMap(Map<Object, Object> map) throws Exception {
	  
	    return jfIntegralDao.updateByMap(map, true);
	}

}
